package com.shelpe.services.simbasync.service.simbaproxy;

import java.util.List;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.Data;


@FeignClient(name="${simbaproxy.serviceID}", url="${simbaproxy.url}")
@RequestMapping(value = "/simba")
public interface UserProxy {
	
	/**
	 * 获取账户余额
	 * 
	 * */
	@RequestMapping(method = RequestMethod.GET, value = "/taobao.simba.account.balance.get")
	public String getAccountBalance(@RequestParam("nick") String nick);
	
	/*
	 * 获取subway_token
	 * */
	@RequestMapping(method = RequestMethod.GET, value = "/taobao.simba.login.authsign.get")
	public String getSubwayTokenByNick(@RequestParam("nick") String nick);
	
	/*
	 * 
	 *获取用户信息
	 * 
	 * */
	@RequestMapping(method = RequestMethod.GET, value = "/taobao.user.seller.get")
	public String getSellerInfo(@RequestHeader("tenantID") long userId, @RequestParam("fields") String fields);
	
	/***
	 * 
	 * 店铺效果数据
	 * 
	 * */
	@RequestMapping(method = RequestMethod.GET, value = "/taobao.simba.rpt.custeffect.get")
	public String getRptCustomerEffect(@RequestParam("subway_token") String subwayToken, @RequestParam("nick") String nick, @RequestParam("source") String source,
			@RequestParam("start_time") String startTime, @RequestParam("end_time") String endTime, 
			@RequestParam("page_size")int pageSize, @RequestParam("page_no")int pageNo);
	
	
	/***
	 * 
	 * 店铺基础数据
	 * 
	 * */
	@RequestMapping(method = RequestMethod.GET, value = "/taobao.simba.rpt.custbase.get")
	public String getRptCustomerBase(@RequestParam("subway_token")String subwayToken, @RequestParam("nick")String nick, @RequestParam("source")String source,
			@RequestParam("start_time") String startTime, @RequestParam("end_time")String endTime, 
			@RequestParam("page_size")int pageSize, @RequestParam("page_no")int pageNo);
	
	
	@RequestMapping(method = RequestMethod.GET, value = "/taobao.simba.rtrpt.cust.get", consumes="application/json;charset=UTF-8")
	public RptCustomerRealtimeResponse getRptCustomerRealtime(@RequestParam("nick") String nick, @RequestParam("the_date") String theDate);
	
	@Data
	public static class RptCustomerRealtimeResponse{
		
		@JsonProperty("simba_rtrpt_cust_get_response")
		private RptCustomerRealtimeRes response;
		
	}
	
	@Data
	public static class RptCustomerRealtimeRes{
		
		@JsonProperty("results")
		private RptCustomerRealtimeResults results;

	}
	
	@Data
	public static class RptCustomerRealtimeResults{
		
		@JsonProperty("rt_rpt_result_entity_d_t_o")
		private List<RptCustomerRealTimeDto> dto;
	}
	
	@Data
	public static class RptCustomerRealTimeDto {

	    @JsonProperty("thedate")
		private String theDate;
   
	    private String cpc;

	    private String ctr;

	    private String impression;

	    private String roi;

	    private String click;

	    private String cost;
	    @JsonProperty("carttotal")
	    private String cartTotal;
	    @JsonProperty("directcarttotal")
	    private String directCartTotal;
	    @JsonProperty("directtransaction")
	    private String directTransaction;
	    @JsonProperty("directtransactionshipping")
	    private String directTransactionShipping;
	    @JsonProperty("favitemtotal")
	    private String favItemTotal;
	    @JsonProperty("favshoptotal")
	    private String favShopTotal;
	    @JsonProperty("favtotal")
	    private String favTotal;
	    @JsonProperty("indirectcarttotal")
	    private String indirectCartTotal;
	    @JsonProperty("indirecttransaction")
	    private String indirectTransaction;
	    @JsonProperty("indirecttransactionshipping")
	    private String indirectTransactionShipping;
	    @JsonProperty("transactiontotal")
	    private String transactionTotal;
	    @JsonProperty("transactionshippingtotal")
	    private String transactionShippingTotal;
	}


}